
#include <vector>

class CanvasObject
{
public:
	CanvasObject();
	virtual ~CanvasObject() = 0;

	virtual void Render(int pass = 0) = 0;
};

class Canvas
{
public:
	Canvas();
	~Canvas();

	int Add(CanvasObject* obj);
	CanvasObject* Get(int id);
	void Clear();
	void Render(int pass = 0);

private:
	std::vector<CanvasObject*> v;
};


class Box : public CanvasObject
{
public:
	Box(int x1, int y1, int z1, int x2, int y2, int z2);
	virtual ~Box();

	virtual void Render(int pass = 0);

private:
	int x1,y1,z1,x2,y2,z2;
};

class Spider : public CanvasObject
{
public:
	Spider(float x = 0, float y = 0, float z = 0);
	virtual ~Spider();

	virtual void Render(int pass = 0);
	void MoveTo(float x, float y, float z);
	void MoveLeg(int leg, float x, float y, float z);
	void SetLegMode(int leg, bool absolute);
	bool GetLegMode(int leg);

	void luapushpos(lua_State* L);
	void luapushlegpos(lua_State* L, int leg);
	void luapushlegmode(lua_State* L, int leg);

private:
	float x, y, z;
	float legs[6][3];
	bool mode[6];
};
